<template>
    <basic-container>
        <avue-crud :option="option"
                   :data="data"
                   ref="crud"
                   v-model="form"
                   :table-loading="loading"
                   @row-del="rowDel"
                   @row-update="rowUpdate"
                   @row-save="rowSave"
                   @refresh-change="refreshChange"
                   @search-change="searchChange"
                   @search-reset="searchReset"
                   @current-change="currentChange"
					:cell-style="cellStyle"
                   @size-change="sizeChange"
                   @on-load="onLoad">
            <!-- 图片格式插槽 -->
            <template slot-scope="{ row }"
                      slot="iconAccUrl">
                <img v-if="row.iconAccUrl" :src="row.iconAccUrl"
                     style="width:50px;height:50px;"/>
            </template>
            <template slot-scope="{ row }"
                      slot="classLevel">
					  <div v-if="row.classLevel==0">
						一级
					  </div>
					  <div v-if="row.classLevel==1">
						二级
					  </div>
					  <div v-if="row.classLevel==2">
						三级
					  </div>
					  <div v-if="row.classLevel==3">
						四级
					  </div>
            </template>
            <!--自定义头部新增按钮-->
            <template slot="menuLeft" slot-scope="row">
                <el-button type="primary" @click="addNew(row)" size="mini" v-has="'/mall-cloud-base/goodsClass/addItem'">新增</el-button>
            </template>
            <!-- 是否显示插槽 -->
            <template slot-scope="{ row }"
                      slot="classDisplay">
                <el-switch @change="rowSwitchChange(row)"
                           v-model="row.classDisplay"></el-switch>
            </template>
            <template slot-scope="{ row }"
                      slot="menu">
               <el-button v-if="row.classLevel<3" type="text"
                         size="small"
                         @click.stop="showOpen(row)">查看
               </el-button>
                <el-button v-if="row.classLevel>=3" type="text"
                           size="small"
                           @click.stop="showOpenFour(row)">查看
                </el-button>
                <el-button type="text"
                           size="small"
                           @click.stop="handleAdd(row.id, row.classLevel, row)" v-if="row.classLevel < 1" v-has="'/mall-cloud-base/goodsClass/addItem'">新增下级
                </el-button>
                <el-button type="text"
                           size="small"
                           @click.stop="handleAddThird(row.id, row.classLevel, row)" v-if="row.classLevel == 1" v-has="'/mall-cloud-base/goodsClass/addItem'">新增下级
                </el-button>
                <el-button type="text"
                           size="small"
                           @click.stop="editOpen(row)"  v-if="row.classLevel < 2" v-has="'/mall-cloud-base/goodsClass/editItem'">编辑
                </el-button>
                <el-button type="text"
                           size="small"
                           @click.stop="editThirdOpen(row)" v-if="row.classLevel == 2" v-has="'/mall-cloud-base/goodsClass/editItem'">编辑
                </el-button>
                <el-button type="text"
                           size="small"
                           @click.stop="editFourOpen(row)" v-if="row.classLevel == 3" v-has="'/mall-cloud-base/goodsClass/editItem'">编辑
                </el-button>
                <el-button type="text"
                           size="small"
                           @click.stop="showClassBrand(row.id)"
                           v-if="row.classLevel == 2" v-has="'/mall-cloud-base/classBrand/findBrandByClass'">品牌
                </el-button>
                <el-button type="text"
                           size="small"
                           @click.stop="salesProp(row)"
                           v-if="row.classLevel == 2" v-has="'/mall-cloud-base/goodsClassSpec/findSpecByClass'">规格设置
                </el-button>
                <el-button type="text"
                           size="small"
                           @click.stop="nature(row)"
                           v-if="row.classLevel == 2" v-has="'/mall-cloud-base/goodsClassSpec/findSpecByClass'">自然属性
                </el-button>
                <el-button type="text"
                           size="small"
                           @click.stop="handleAddFour(row.id, row.classLevel, row)" v-if="row.classLevel == 2" v-has="'/mall-cloud-base/goodsClass/addItem'">新增下级
                </el-button>
            </template>
        </avue-crud>
        <el-dialog title="分类品牌"
                   :visible.sync="box"
                   v-if="box"
                   top="5vh"
                   width="70%">
            <classBrand :classId="classId"></classBrand>
        </el-dialog>

        <el-dialog :title="salePrototypeTitle"
                   :visible.sync="salesPropetyDialog"
                   @closed="close"
                   @open="salePropListOpen"
                   top="5vh"
                   width="70%">
            <basic-container>
                <avue-crud :data="salesPropData"
                           :option="propOption">
                    <template slot="menuLeft">
                        <el-button type="primary"
                                   size="small"
                                   @click="addPrototype" v-has="'/mall-cloud-base/goodsClassSpec/addItem'">{{specType == '0'?'新增规格':'新增属性'}}
                        </el-button>
                    </template>
                    <template slot-scope="scope"
                              slot="menu">
                        <el-button size="small"
                                   type="primary"
                                   @click="removeProp(scope)" v-has="'/mall-cloud-base/goodsClassSpec/delete'">移除
                        </el-button>
                    </template>
                </avue-crud>
                <el-dialog :title="changePrototyTitle"
                           :visible.sync="changeprototy"
                           width="62%"
                           top="5vh"
                           @open="addPropListOpen"
                           @closed="addPropListClose"
                           append-to-body>
                    <avue-crud :option="changeProOption"
                               :data="changeProData"
                               :page="allSalePropPage"
							   ref='allSale'
                               @search-change="searchChangeList"
                               @current-change="addSpecChangeCurrent"
							   @size-change="addSpecSizeChange"
                               @search-reset="searchResetList">
                        <template slot-scope="row"
                                  slot="menu">
                            <el-button type="primary"
                                       size="small"
                                       @click="addProp(row)" v-has="'/mall-cloud-base/goodsClassSpec/addItem'">添加
                            </el-button>
                        </template>
                    </avue-crud>
                </el-dialog>
            </basic-container>
        </el-dialog>

        <!--头部新增去掉服务费率-->
        <el-dialog title="新增" :visible.sync="addVisible" width="50%" @closed="clearAddfrom">
            <el-form :model="addForm" ref="addForm" label-width="100px" :rules="addFormRules" size="mini">
                <el-form-item label='品类名称' prop="className">
                    <el-col :span="22">
                        <el-input v-model="addForm.className" maxlength='10' show-word-limit placeholder="请输入品类名称"></el-input>
                    </el-col>
                </el-form-item>
                <el-form-item label="排序" prop="classSequence">
                    <el-col :span="22">
                        <el-input v-model="addForm.classSequence" maxlength="9" show-word-limit placeholder="请输入排序号"></el-input>
                    </el-col>
                </el-form-item>
                <el-form-item label="广告位编码" prop="advPosEnc">
                    <el-col :span="22">
                        <el-input v-model="addForm.advPosEnc" placeholder="请输入广告位编码"></el-input>
                    </el-col>
                </el-form-item>

                <el-form-item label="品类图片" prop="iconAccUrl"
                >
                    <div>
                        <el-col :span="12">
                            <el-form-item>
                                <el-input  v-model="addForm.iconAccUrl" size="mini"  readonly @focus="selFileOpen" placeholder="图片比例：1：1"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col style="width: 40px;height: 40px;overflow: hidden;margin-left: 15px;background: #f5f6f7;text-align: center;" >
                            <div class="demo-image__preview">
                                <el-image :src="addForm.iconAccUrl"
                                          width="40"
                                          height="40"
                                >
                                    <div slot="error" class="image-slot">
                                        <i class="el-icon-picture-outline" style="font-size: 18px"></i>
                                    </div>
                                </el-image>
                            </div>
                        </el-col>
                        <el-col style="width: 90px;margin-left: 15px;">
                            <el-form-item prop="adAccUrl">
                                <el-button icon="el-icon-search" type="primary" size="mini" @click="selFileOpen">浏览
                                </el-button>
                            </el-form-item>
                        </el-col>
                    </div>
                </el-form-item>
            </el-form>
            <span slot="footer" class="dialog-footer">
				<el-button type="primary" @click="submitAdd('addForm')" size="mini" :loading="addLoad" v-has="'/mall-cloud-base/goodsClass/addItem'">提交</el-button>
				<el-button type="default" @click="clearAddfrom('addForm')" size="mini">取消</el-button>
			</span>
        </el-dialog>
        <!--新增第二级-->
        <el-dialog title="新增下级" :visible.sync="addChildVisible" width="50%" @closed="clearAddChildfrom">
            <el-form :model="addChildForm" ref="addChildForm" label-width="80px" :rules="addChildFormRules" size="mini">
                <el-form-item label='品类名称' prop="className">
                    <el-col :span="22">
                        <el-input v-model="addChildForm.className" maxlength='10' show-word-limit  placeholder="请输入品类名称"></el-input>
                    </el-col>
                </el-form-item>
                <el-form-item label="排序" prop="classSequence">
                    <el-col :span="22">
                        <el-input v-model="addChildForm.classSequence" maxlength='9' show-word-limit  placeholder="请输入排序号"></el-input>
                    </el-col>
                </el-form-item>

<!--                <el-form-item label="广告位编码" prop="advPosEnc">-->
<!--                    <el-col :span="22">-->
<!--                        <el-input v-model="addChildForm.advPosEnc" placeholder="请输入广告位编码"></el-input>-->
<!--                    </el-col>-->
<!--                </el-form-item>-->
                <el-form-item label="品类图片" prop="iconAccUrl">
                    <div>
                        <el-col :span="12">
                            <el-form-item prop="iconAccUrl">
                                <el-input  v-model="addChildForm.iconAccUrl" readonly @focus="selFileOpen" size="mini" placeholder="图片比例：1：1"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col style="width: 40px;height: 40px;overflow: hidden;margin-left: 15px;background: #f5f6f7;text-align: center;" >
                            <div class="demo-image__preview">
                                <el-image :src="addChildForm.iconAccUrl"
                                          width="40"
                                          height="40"
                                        >
                                        <div slot="error" class="image-slot">
                                        <i class="el-icon-picture-outline" style="font-size: 18px"></i>
                                    </div>
                                </el-image>
                            </div>
                        </el-col>
                        <el-col style="width: 90px;margin-left: 15px;">
                            <el-form-item >
                                <el-button icon="el-icon-search" type="primary" size="mini" @click="selFileOpen">浏览
                                </el-button>
<!--                                <selFile ref="selFileNextNew" @callback="selFileAddChildCallBack" albumCode="pic_root" dialogTitle="选择图片"-->
<!--                                         selectType="radio" selMaxWidth="300px" selMaxHeight="300px"></selFile>-->

                            </el-form-item>
                        </el-col>
                    </div>
                </el-form-item>
            </el-form>
            <span slot="footer" class="dialog-footer">
				<el-button type="primary" @click="submitAddChild('addChildForm')" size="mini" :loading="loadChild" v-has="'/mall-cloud-base/goodsClass/addItem'">提交</el-button>
				<el-button type="default" @click="clearAddChildfrom('addChildForm')" size="mini">取消</el-button>
			</span>
        </el-dialog>
       <!--新增第三级-->
        <el-dialog title="新增下级" :visible.sync="addThirdChildVisible" width="50%" @closed="clearAddThirdChildfrom">
            <el-form :model="addThirdChildForm" ref="addThirdChildForm" label-width="80px" :rules="addThirdChildFormRules" size="mini">
                <el-form-item label='品类名称' prop="className">
                    <el-col :span="22">
                        <el-input v-model="addThirdChildForm.className" maxlength='10' show-word-limit  placeholder="请输入品类名称"></el-input>
                    </el-col>
                </el-form-item>
                <el-form-item label="排序" prop="classSequence">
                    <el-col :span="22">
                        <el-input v-model="addThirdChildForm.classSequence" maxlength='9' show-word-limit  placeholder="请输入排序号"></el-input>
                    </el-col>
                </el-form-item>
            </el-form>
            <span slot="footer" class="dialog-footer">
				<el-button type="primary" @click="submitAddThirdChild('addThirdChildForm')" size="mini" :loading="loadThirdChild" v-has="'/mall-cloud-base/goodsClass/addItem'">提交</el-button>
				<el-button type="default" @click="clearAddThirdChildfrom('addThirdChildForm')" size="mini">取消</el-button>
			</span>
        </el-dialog>
<!--        新增第四级-->
        <el-dialog title="新增下级" :visible.sync="addFourChildVisible" width="50%" @closed="clearAddFourChildfrom">
            <el-form :model="addFourChildForm" ref="addFourChildForm" label-width="140px" :rules="addFourChildFormRules" size="mini">
                <el-form-item label='税务品类名称' prop="className">
                    <el-col :span="22">
                        <el-input v-model="addFourChildForm.className" maxlength='10' show-word-limit  placeholder="请输入税务品类名称"></el-input>
                    </el-col>
                </el-form-item>
                <el-form-item label="排序" prop="classSequence">
                    <el-col :span="22">
                        <el-input v-model="addFourChildForm.classSequence" maxlength='9' show-word-limit  placeholder="请输入排序号"></el-input>
                    </el-col>
                </el-form-item>
            </el-form>
            <span slot="footer" class="dialog-footer">
				<el-button type="primary" @click="submitAddFourChild('addFourChildForm')" size="mini" :loading="loadFourChild" v-has="'/mall-cloud-base/goodsClass/addItem'">提交</el-button>
				<el-button type="default" @click="clearAddFourChildfrom('addFourChildForm')" size="mini">取消</el-button>
			</span>
        </el-dialog>

        <!--编辑-->
        <el-dialog title="编辑" :visible.sync="editVisible" width="50%" v-if="editVisible" @close="closeEdit">
            <el-form :model="editForm" ref="editForm" label-width="100px" :rules="addChildFormRules" size="mini">
                <el-form-item label='品类名称' prop="className">
                    <el-col :span="22">
                        <el-input v-model="editForm.className" maxlength='10' show-word-limit  placeholder="请输入品类名称"></el-input>
                    </el-col>
                </el-form-item>
                <el-form-item label="排序" prop="classSequence">
                    <el-col :span="22">
                        <el-input v-model="editForm.classSequence" maxlength='9' show-word-limit  placeholder="请输入排序号"></el-input>
                    </el-col>
                </el-form-item>


                <el-form-item label="广告位编码" prop="advPosEnc" v-if="editForm.classLevel == 0">
                    <el-col :span="22">
                        <el-input v-model="editForm.advPosEnc" placeholder="请输入广告位编码"></el-input>
                    </el-col>
                </el-form-item>
                <el-form-item label="品类图片" prop="iconAccUrl">
                    <div>
                        <el-col :span="12">
                            <el-form-item>
                                <el-input  v-model="editForm.iconAccUrl" readonly @focus="selFileOpen" size="mini"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col style="width: 40px;height: 40px;overflow: hidden;margin-left: 15px;background: #f5f6f7;text-align: center;" >
                            <div class="demo-image__preview">
                                <el-image :src="editForm.iconAccUrl"
                                          width="40"
                                          height="40"
                                    >
                                    <div slot="error" class="image-slot">
                                        <i class="el-icon-picture-outline" style="font-size: 18px"></i>
                                    </div>
                                </el-image>
                            </div>
                        </el-col>
                        <el-col style="width: 90px;margin-left: 15px;">
                            <el-form-item >
                                <el-button icon="el-icon-search" type="primary" size="mini" @click="selFileOpen">浏览
                                </el-button>
                            </el-form-item>
                        </el-col>
                    </div>
                </el-form-item>
            </el-form>
            <span slot="footer" class="dialog-footer">
				<el-button type="primary" :disabled="editDisabled" @click="submitEdit('editForm')" size="mini" v-has="'/mall-cloud-base/goodsClass/editItem'">提交</el-button>
			</span>
        </el-dialog>
        <!--编辑第三级分类-->
        <el-dialog title="编辑" :visible.sync="editThirdVisible" width="50%" v-if="editThirdVisible" @closed="closeSelFile">
            <el-form :model="editThirdForm" ref="editThirdForm" label-width="100px" :rules="addThirdChildFormRules" size="mini">
                <el-form-item label='品类名称' prop="className">
                    <el-col :span="22">
                        <el-input v-model="editThirdForm.className" maxlength='10' show-word-limit  placeholder="请输入品类名称"></el-input>
                    </el-col>
                </el-form-item>
                <el-form-item label="排序" prop="classSequence">
                    <el-col :span="22">
                        <el-input v-model="editThirdForm.classSequence" maxlength='9' show-word-limit  placeholder="请输入排序号"></el-input>
                    </el-col>
                </el-form-item>
                <el-form-item label="广告位编码" prop="advPosEnc" v-if="editThirdForm.classLevel == 0">
                    <el-col :span="22">
                        <el-input v-model="editThirdForm.advPosEnc" placeholder="请输入广告位编码"></el-input>
                    </el-col>
                </el-form-item>
            </el-form>
            <span slot="footer" class="dialog-footer">
				<el-button :disabled="isDisabled" type="primary" @click="submitEditThird('editThirdForm')" size="mini" v-has="'/mall-cloud-base/goodsClass/editItem'">提交</el-button>
			</span>
        </el-dialog>
        <!--编辑第四级分类-->
        <el-dialog title="编辑" :visible.sync="editFourVisible" width="50%" v-if="editFourVisible" @closed="closeSelFile">
            <el-form :model="editFourForm" ref="editFourForm" label-width="160px" :rules="addFourChildFormRules" size="mini">
                <el-form-item label='税务品类名称' prop="className">
                    <el-col :span="22">
                        <el-input v-model="editFourForm.className" maxlength='10' show-word-limit  placeholder="请输入税务品类名称"></el-input>
                    </el-col>
                </el-form-item>
                <el-form-item label="排序" prop="classSequence">
                    <el-col :span="22">
                        <el-input v-model="editFourForm.classSequence" maxlength='9' show-word-limit  placeholder="请输入排序号"></el-input>
                    </el-col>
                </el-form-item>
                <el-form-item label='货物和劳务名称' prop="nameOfService">
                    <el-col :span="22">
                        <el-input disabled v-model="editFourForm.nameOfService" maxlength='10' show-word-limit></el-input>
                    </el-col>
                </el-form-item>
                <el-form-item label="税收分类编码" prop="taxClassificationCode">
                    <el-col :span="22">
                        <el-input disabled v-model="editFourForm.taxClassificationCode" minlength='19' maxlength='19' show-word-limit></el-input>
                    </el-col>
                </el-form-item>
                <el-form-item label="一般税率(%)" prop="generalTaxRate">
                    <el-col :span="22">
                        <el-input disabled v-model="editFourForm.generalTaxRate" minlength='19' maxlength='19' show-word-limit></el-input>
                    </el-col>
                </el-form-item>
                <el-form-item label="小规模税率(%)" prop="smallScaleTaxRate">
                    <el-col :span="22">
                        <el-input disabled v-model="editFourForm.smallScaleTaxRate" minlength='19' maxlength='19' show-word-limit ></el-input>
                    </el-col>
                </el-form-item>
                <el-form-item label="特殊地区税率(%)" prop="specialTaxRate">
                    <el-col :span="22">
                        <el-input disabled v-model="editFourForm.specialTaxRate" minlength='19' maxlength='19' show-word-limit ></el-input>
                    </el-col>
                </el-form-item>
            </el-form>
            <span slot="footer" class="dialog-footer">
				<el-button :disabled="isDisabled" type="primary" @click="submitEditFour('editFourForm')" size="mini" v-has="'/mall-cloud-base/goodsClass/editItem'">提交</el-button>
			</span>
        </el-dialog>
        <!--查看-->
         <el-dialog title="查看" :visible.sync="showVisible" width="50%" v-if="showVisible" @close="closeShow">
                    <el-form :model="showForm" ref="showForm" label-width="100px" :rules="addChildFormRules" size="mini">
                        <el-form-item label='品类名称' prop="className">
                            <el-col :span="22">
                                <el-input v-model="showForm.className"  placeholder="请输入品类名称" :disabled="true"></el-input>
                            </el-col>
                        </el-form-item>
                        <el-form-item label="排序" prop="classSequence">
                            <el-col :span="22">
                                <el-input v-model="showForm.classSequence" placeholder="请输入排序号" :disabled="true"></el-input>
                            </el-col>
                        </el-form-item>
                        <el-form-item label="广告位编码" prop="advPosEnc" v-if="showForm.classLevel == 0">
                            <el-col :span="22">
                                <el-input v-model="showForm.advPosEnc" placeholder="请输入广告位编码" :disabled="true"></el-input>
                            </el-col>
                        </el-form-item>
                        <el-form-item label="品类图片" prop="iconAccUrl">
                            <div>
                                <el-col :span="12">
                                    <el-form-item>
                                        <el-input  v-model="showForm.iconAccUrl" size="mini" :disabled="true"> </el-input>
                                    </el-form-item>
                                </el-col>
                                <el-col style="width: 40px;height: 40px;overflow: hidden;margin-left: 15px;background: #f5f6f7;text-align: center;" >
                                    <div class="demo-image__preview">
                                        <el-image :src="showForm.iconAccUrl"
                                                  width="40"
                                                  height="40"
                                            >
                                            <div slot="error" class="image-slot">
                                                <i class="el-icon-picture-outline" style="font-size: 18px"></i>
                                            </div>
                                        </el-image>
                                    </div>
                                </el-col>

                            </div>
                        </el-form-item>
                    </el-form>
                </el-dialog>
<!--        四级查看-->
        <el-dialog title="查看" :visible.sync="showVisibleFour" width="50%" v-if="showVisibleFour" @close="closeShow">
            <el-form :model="showForm" ref="showForm" label-width="160px" :rules="addChildFormRules" size="mini">
                <el-form-item label='税务品类名称' prop="className">
                    <el-col :span="22">
                        <el-input v-model="showForm.className"  placeholder="请输入税务品类名称" :disabled="true"></el-input>
                    </el-col>
                </el-form-item>
                <el-form-item label="排序" prop="classSequence">
                    <el-col :span="22">
                        <el-input v-model="showForm.classSequence" placeholder="请输入排序号" :disabled="true"></el-input>
                    </el-col>
                </el-form-item>
                <el-form-item label='货物和劳务名称' prop="nameOfService">
                    <el-col :span="22">
                        <el-input disabled v-model="editFourForm.nameOfService" maxlength='10' show-word-limit></el-input>
                    </el-col>
                </el-form-item>
                <el-form-item label="税收分类编码" prop="taxClassificationCode">
                    <el-col :span="22">
                        <el-input disabled v-model="editFourForm.taxClassificationCode" minlength='19' maxlength='19' show-word-limit ></el-input>
                    </el-col>
                </el-form-item>
                <el-form-item label="一般税率(%)" prop="generalTaxRate">
                    <el-col :span="22">
                        <el-input disabled v-model="editFourForm.generalTaxRate" minlength='19' maxlength='19' show-word-limit ></el-input>
                    </el-col>
                </el-form-item>
                <el-form-item label="小规模税率(%)" prop="smallScaleTaxRate">
                    <el-col :span="22">
                        <el-input disabled v-model="editFourForm.smallScaleTaxRate" minlength='19' maxlength='19' show-word-limit ></el-input>
                    </el-col>
                </el-form-item>
                <el-form-item label="特殊地区税率(%)" prop="specialTaxRate">
                    <el-col :span="22">
                        <el-input disabled v-model="editFourForm.specialTaxRate" minlength='19' maxlength='19' show-word-limit></el-input>
                    </el-col>
                </el-form-item>
            </el-form>
        </el-dialog>
		<selFile ref="selFile" @callback="selFileAddCallBack" albumCode="pic_root" dialogTitle="选择图片"
				 selectType="radio" selMaxWidth="300px" selMaxHeight="300px"></selFile>
    </basic-container>
</template>
<script>
    import selFile from '@/components/file/selFile'
    import uploadPic from '@/components/file/uploadPic';
    import classBrand from "@/components/goods/classBrand";
    import {
        getspecPrototype,
        remove,
        getAllSalesProp,
        setAddProp
    } from "@/api/base/goods/goodsSpecProperty";

    import {
        getList,
        update,
        add,
        updateDisplay,
        removeClass,
        detail
    } from "@/api/base/goods/goodsClass";
    import {mapGetters} from "vuex";
    import {
        testSort,testGoodsSerial,validateFormat,validateFormatLine,validateNum
    } from '@/util/util'

    export default {
        name: "parent",
        data() {
            return {
                srcDefault:'/src/styles/empty.png',
				editDisabled:false,
				isDisabled:false,
                loadChild:false,
                loadThirdChild:false,
                loadFourChild:false,
                addLoad:false,
                allSalePropPage: {
                    pageSize: 10,
                    currentPage: 1,
                    total: 0
                },
				saleQuery:{},
                classId: "",
                parentId: "",
                goodsClassId: "",
                salesPropData: [],
                changeProData: [], //获取所有属性值列表
                specType: "0", //规格设置0   自然属性1
                changePrototyTitle:"选择属性",
                changeprototy: false,
                salesPropetyDialog: false, //规格设置dialog
                naturePropDoalog: false, //自然属性dialog
                classLevel: 0, //一级菜单 0   二级菜单 1   三级菜单   2
                salePrototypeTitle: "",
                form: {},
                query: {},
                loading: true,
                rolesTree: [],
                rolesKeys: [],
                rowData: {}, //新增下级数据
                box: false,
                option: {
                    addBtn: false,
                    editBtn: false,
                    size: 'mini',
                    tip: false,
                    border: true,
                    // selection: true,
                    viewBtn: false,
                    rowKey: "id",
                    height: 'auto',
                    // calcHeight: 380,
                    dialogType: "dialog",
                    menuWidth: 350,
                    defaultExpandAll: false,
                    labelWidth: 300,
                    align:"center",
                    treeProps: {
                        children: "childrenNodes"
                    },
                    column: [
                        {
                            label: "品类名称",
                            prop: "className",
                            fixed: true,
                            fit:true,
                            rules: [
                                {
                                    required: true,
                                    message: "请输入品类名称",
                                    trigger: 'blur'
                                },{
                                    validator:validateFormatLine,
                                    trigger:'blur'
                                }
                            ]
                        },
                        {
                            label: "层级",
                            prop: "classLevel",
                            slot:true,
                            rules: [
                                {
                                    required: true,
                                    message: "请输入层级",
                                    trigger: 'blur'
                                }
                            ]
                        },
                        {
                            label: "排序",
                            prop: "classSequence",
                            type: 'number',
                            minRows: 0,
                            rules: [
                                {
                                    required: true,
                                    message: "请输入排序",
                                    trigger: 'blur'
                                }
                            ]
                        },
                        {
                            label: "广告位编码",
                            prop: "advPosEnc",
                            hide: true,
							rules: [
								{
								    validator: testGoodsSerial,
								    trigger: 'blur'
								},
							]
                        },
                        {
                            label: "品类图片",
                            prop: "iconAccUrl",
                            formslot: true,
                            slot: true,
                            span: 24,
                        },
                        {
                            label: "是否显示",
                            prop: "classDisplay",
                            slot: true,
                            display: false,
                            rules: [
                                {
                                    required: true,
                                    message: "请输入是否显示",
                                    trigger: 'blur'
                                }
                            ]
                        }
                    ]
                },
                data: [],
                propOption: {
                    page: false,
                    align: "center",
                    menuAlign: "center",
                    addBtn: false,
                    editBtn: false,
                    refreshBtn: false,
                    columnBtn: false,
                    delBtn: false,
                    border: true,
                    column: [
                        {
                            label: "属性名称",
                            prop: "specName"
                        },
                        {
                            label: "属性值",
                            prop: "specpValue"
                        }
                    ]
                },
                changeProOption: {
                    addBtn: false,
                    editBtn: false,
                    refreshBtn: false,
                    columnBtn: false,
                    delBtn: false,
                    headerAlign: "center",
                    align: "center",
                    menuType: "button",
                    border: true,
                    column: [
                        {
                            label: "属性名称",
                            prop: "specName",
                            search: true
                        },
                        {
                            label: "属性值",
                            prop: "specpValue"
                        }
                    ]
                },
                //新增按钮弹框内容
                addForm: {
                    className: "",
                    classSequence: "",
                    advPosEnc: "",
                    iconAccUrl: "",
                },
                addFormRules: {
                    className: [{
                        required: true,
                        message: "请输入品类名称",
                        trigger: 'blur'
                    }, {
                        max: 10,
                        message: '输入长度不得多于10个长度',
                        trigger: 'blur'
                    }, {
                        validator:validateFormatLine,
                        trigger:'blur'
                        }
                    ],
                    classSequence: [{
                        required: true,
                        message: "请输入排序号",
                        trigger: 'blur'
                    },
                        {
                        validator: testSort,
                        },
                    ],
                    // advPosEnc: [
                    //     {
                    //     required: true,
                    //     message: "请输入广告位编码",
                    //     trigger: 'blur'
                    //     },
                    //     {
                    //         validator: testGoodsSerial,
                    //         trigger: 'blur'
                    //     }
                    // ],
                    iconAccUrl: [{
                        required: true,
                        message: "请选择品类图片",
                        trigger: 'change'
                    }]
                },
                addVisible: false,
                //子女增下级弹框
                addChildVisible: false,
                //新增第三级弹框
                addThirdChildVisible: false,
                // 新增第四级
                addFourChildVisible: false,
                addChildForm: {
                    className: "",
                    classSequence: "",
                    advPosEnc: "",
                    iconAccUrl: "",
                    classLevel: "",
                    parentId: "",
                },
                addThirdChildForm: {
                    className: "",
                    classSequence: "",
                    advPosEnc: "",
                    iconAccUrl: "",
                    classLevel: "",
                    parentId: "",
                },
                addFourChildForm: {
                    className: "",
                    classSequence: "",
                    advPosEnc: "",
                    iconAccUrl: "",
                    classLevel: "",
                    parentId: "",
                    // nameOfService:"",
                    // taxClassificationCode:"",
                },
                addChildFormRules: {
                    className: [{
                        required: true,
                        message: "请输入品类名称",
                        trigger: 'blur'
                    },
                     {max: 10, message: '输入长度不得多于10个长度', trigger: 'blur'},
                        {
                            validator:validateFormatLine,
                            trigger:'blur'
                        }
                    ],
                    classSequence: [{
                        required: true,
                        message: "请输入排序号",
                        trigger: 'blur'
                    },
                        {
                            validator: testSort,
                        },
                    ],
                    // advPosEnc: [{
                    //     required: true,
                    //     message: "请输入广告位编码",
                    //     trigger: 'blur'
                    // },
                    //     {
                    //         validator: testGoodsSerial,
                    //         trigger: 'blur'
                    //     },
                    // ],
                    iconAccUrl: [{
                        required: true,
                        message: "请选择品类图片",
                        trigger: 'change'
                    }]
                },

                addThirdChildFormRules: {
                    className: [{
                        required: true,
                        message: "请输入品类名称",
                        trigger: 'blur'
                    },
                        {max: 10, message: '输入长度不得多于10个长度', trigger: 'blur'},
                        {
                            validator:validateFormatLine,
                            trigger:'blur'
                        }
                    ],
                    classSequence: [{
                        required: true,
                        message: "请输入排序号",
                        trigger: 'blur'
                    },
                        {
                            validator: testSort,
                        },
                    ]
                },
                addFourChildFormRules: {
                    className: [{
                        required: true,
                        message: "请输入税务品类名称",
                        trigger: 'blur'
                        },
                        {validator:validateFormatLine,trigger:'blur'}
                    ],
                    classSequence: [{
                        required: true,
                        message: "请输入排序号",
                        trigger: 'blur'
                        },
                        {validator: testSort,trigger:'blur'}],
                },

                //编辑按钮弹框内容
                editForm: {
                    className: "",
                    classSequence: "",
                    advPosEnc: "",
                    iconAccUrl: "",
                    id: ""
                },
                editThirdForm: {
                    className: "",
                    classSequence: "",
                    advPosEnc: "",
                    iconAccUrl: "",
                    id: ""
                },
                editFourForm: {
                    className: "",
                    classSequence: "",
                    advPosEnc: "",
                    iconAccUrl: "",
                    id: "",
                    nameOfService:"",
                    taxClassificationCode:""

                },
                showForm: {
                    className: "",
                    classSequence: "",
                    advPosEnc: "",
                    iconAccUrl: "",
                    id: ""
                },
                showVisible: false,
                showVisibleFour: false,
                editVisible: false,
                editThirdVisible: false,
                editFourVisible: false,
            };
        },
        computed: {
            ...mapGetters(["permission", "userInfo"]),
            permissionList() {
                return {
                    delBtn: this.vaildData(this.permission["/mall-cloud-base/goodsClass/delete"], false),
                };
            },
        },
        components: {
            classBrand,
            selFile,
            uploadPic
        },
      watch:{
          'editVisible'(val){
            if(!val){
              this.$refs["editForm"].resetFields();
            }
          },
          'editThirdVisible'(val){
              if(!val){
                  this.$refs["editThirdForm"].resetFields();
              }
          },
          'editFourVisible'(val){
              if(!val){
                  this.$refs["editFourForm"].resetFields();
              }
          },
        'addVisible'(val){
          if(!val){
            this.$refs["addForm"].resetFields();
            this.addLoad=false
          }
        },
          'addChildVisible'(val){
              if(!val){
                  this.$refs["addChildForm"].resetFields();
                  this.loadChild=false
              }
          },
          'addThirdChildVisible'(val){
              if(!val){
                  this.$refs["addThirdChildForm"].resetFields();
                  this.loadThirdChild=false
              }
          },
          'addFourChildVisible'(val){
              if(!val){
                  this.$refs["addFourChildForm"].resetFields();
                  this.loadFourChild=false
              }
          },
      },
        methods: {
            rowAdd() {
            },
            // 选择图片
            selFileCallBack(obj) {
                console.log(obj)
                this.form.iconAccUrl = obj[0];
                this.$refs.ipt.focus();
            },
            selFileAddCallBack(obj) {
                if(this.addVisible){
                    this.addForm.iconAccUrl = obj[0];
                    console.log("新增父级上传图片");
                }
                else if(this.addChildVisible){
                    this.addChildForm.iconAccUrl = obj[0];
                    console.log("新增一级分类上传图片");
                }
                else if(this.addThirdChildVisible){
                    this.addThirdChildForm.iconAccUrl = obj[0];
                    console.log("新增二级分类上传图片");
                }
                else if(this.addFourChildVisible){
                    this.addFourChildForm.iconAccUrl = obj[0];
                    console.log("新增三级分类上传图片");
                }
                else if(this.editVisible){
                    this.editForm.iconAccUrl = obj[0];
                    console.log("编辑分类上传图片");
                }
                else if(this.editThirdVisible){
                    this.editThirdForm.iconAccUrl = obj[0];
                    console.log("编辑第三分类上传图片");
                }
                else if(this.editFourVisible){
                    this.editFourForm.iconAccUrl = obj[0];
                    console.log("编辑第四分类上传图片");
                }
                this.$refs.ipt.focus();
            },

            closeSelFile() {
                this.$refs.selFile.close()
            },
            selFileOpen() {
                console.log('open')
                console.log('this',this.$refs)
                this.$refs.selFile.open()
            },
            close() {
            },
            salePropListOpen() {
                this.getPrototypeData();
            },
            addPropListClose() {
				this.allSalePropPage.currentPage=1
				this.$refs.allSale.searchReset()
            },
            addPropListOpen() {
                getAllSalesProp(
                    this.allSalePropPage.currentPage,
                    this.allSalePropPage.pageSize,
                    {specType: this.specType}
                ).then(res => {
                    if (res.status == 200) {
                        this.changeProData = this.handleData(res.data.data);
                    }
                });
            },
            addPrototype() {
                //点击新增属性将dialog打开
                this.changeprototy = true;
                console.log(this.specType);
                if(this.specType == "0"){
                    this.changePrototyTitle = "选择规格";
                    this.changeProOption.column[0].label = "规格名称";
                    this.changeProOption.column[1].label = "规格值";
                }
                else if(this.specType == "1"){
                    this.changePrototyTitle = "选择属性";
                    this.changeProOption.column[0].label = "属性名称";
                    this.changeProOption.column[1].label = "属性值";
                }
                // this.addPropListOpen();
            },
            addProp(row) {
                //行操作新增属性
                //传参1.goodsClassId  2.gsfId   3.SpecType
                setAddProp(
                    this.goodsClassId,
                    row.row.id,
                    row.row.specType.toString()
                ).then(res => {
                    if (res.status == 200 && res.data.code == 200) {
                        this.$message.success("添加成功");
                        this.getPrototypeData();
                    } else {
                        this.$message.error(res.data.message);
                    }
                });
            },
            getPrototypeData() {
                //获取规格设置列表数据  自然属性数据
                getspecPrototype({
                    goodsClassId: this.goodsClassId,
                    specType: this.specType
                })
                    .then(res => {
                        if (res.status == 200) {
                            this.salesPropData = this.handleData(res.data.data);
                        }
                    })
                    .catch(() => {
                        this.$message.error("属性获取失败");
                    });
            },
            removeProp(scope) {
                this.$confirm("移除属性可能会对已有商品造成影响,是否继续?", {
                    confirmButtonText: "确定",
                    cancelButtonText: "取消",
                    type: "warning"
                }).then(() => {
                    //规格设置移除操作方法
                    remove(this.goodsClassId, scope.row.id).then(res => {
                        if (res.data.success) {
                            this.$message.success("操作成功");
                            this.getPrototypeData();
                        }
                        else {
                            this.$message.error(res.data.message);
                        }
                    });
                })

            },
            //自然属性方法
            nature(row) {
				console.log(row)
                this.salePrototypeTitle = row.className + "自然属性";
                this.specType = "1";
                this.goodsClassId = row.id;
				this.addPropList(this.allSalePropPage,{specType:this.specType})
                this.salesPropetyDialog = true;
                this.propOption.column[0].label = "属性名称";
                this.propOption.column[1].label = "属性值";
            },
            //规格设置方法
            salesProp(row) {
				console.log(row)
                //点击规格设置弹出弹框  触发dialog 打开事件
                this.salePrototypeTitle = row.className + "规格设置";
                this.specType = "0";
                this.goodsClassId = row.id;
				this.addPropList(this.allSalePropPage,{specType:this.specType})
                this.salesPropetyDialog = true;
                this.propOption.column[0].label = "规格名称";
				this.propOption.column[1].label = "规格值";
            },
            handleData(data) {
                //处理数据方法
                let dataArr = [];
                data.forEach(item => {
                    let specpValues = [];
                    specpValues = item.childrenNodes.map(item => {
                        return item.specpValue;
                    });
                    item.specpValue = specpValues.join("，");
                    dataArr.push(item);
                });
                return dataArr;
            },
            rowSave(row, loading) {
                //添加一级商品
                this.rowData = row;
                this.rowData.classLevel = this.classLevel; //设置当前商品等级默认为0(一级商品)
                this.rowData.parentId = this.parentId;
                this.productSave(this.rowData, loading);
            },
            //保存商品请求方法
            productSave(rowData, loading) {
                add(rowData)
                    .then(res => {
                        if (res.data.code == 200) {
                            this.$message({
                                type: "success",
                                message: "新增成功"
                            });
                            loading();
                            this.onLoad(this.page);
                            this.classLevel = 0;
                            this.parentId = "";
                        }
                    })
                    .catch(err => {
                        if (err) {
                            this.$message({
                                type: "error",
                                message: "新增失败"
                            });
                        }
                    });
            },
            rowUpdate(row, index, loading, done) {
                row.position = row.positionIds;
                update(row).then(
                    () => {
                        loading();
                        this.onLoad(this.page);
                        this.$message({
                            type: "success",
                            message: "操作成功!"
                        });
                    },
                    () => {
                        done();
                    }
                );
            },
            rowDel(row) {
                this.$confirm("确定将选择数据删除?", {
                    confirmButtonText: "确定",
                    cancelButtonText: "取消",
                    type: "warning"
                })
                    .then(() => {
                        return removeClass(row.id)
                            .then(res => {
                                if (res.data.success) {
                                    this.$message.success("刪除成功！");
                                    this.onLoad(this.page);
                                }
                                else {
                                    this.$message.error(res.data.message);
                                }
                            });
                    })
            },
            rowSwitchChange(row) {
                if (row.classDisplay) {
                    updateDisplay(row.id, "true");
                } else {
                    updateDisplay(row.id, "false");
                }
            },
            //打开新增弹框
            addNew(row) {
                this.addVisible = true
            },
            //打开新增下级弹框(这里只新增第二级分类)
            handleAdd(parentId, classLevel, row) {
                //当前行商品等级 为 0  新增的商品等级为1
                this.classLevel = 1;
                this.parentId = parentId;
                this.addChildForm.parentId = this.parentId;
                this.addChildForm.classLevel = this.classLevel;
                this.addChildVisible = true;
                console.log(this.addChildForm)
            },
            //打开新增下级弹框(这里只新增第三级分类)
            handleAddThird(parentId, classLevel, row) {
                //当前行商品等级 为 1  新增的商品等级为2
                this.classLevel = 2;
                this.parentId = parentId;
                this.addThirdChildForm.parentId = this.parentId;
                this.addThirdChildForm.classLevel = this.classLevel;
                this.addThirdChildVisible = true;
                console.log(this.addThirdChildForm)
            },
            //打开新增下级弹框(这里只新增第四季分类)
            handleAddFour(parentId, classLevel, row) {
                //当前行商品等级 为 1  新增的商品等级为2
                this.classLevel = 3;
                this.parentId = parentId;
                this.addFourChildForm.parentId = this.parentId;
                this.addFourChildForm.classLevel = this.classLevel;
                // this.addFourChildForm.nameOfService="";
                // this.addFourChildForm.taxClassificationCode="";
                this.addFourChildVisible = true;
                console.log(this.addFourChildForm)
            },

            //打开编辑弹框
            editOpen(row) {
                this.editVisible = true
                this.editForm.classSequence = row.classSequence
                this.editForm.className = row.className
                this.editForm.iconAccUrl = row.iconAccUrl
                this.editForm.advPosEnc = row.advPosEnc
                this.editForm.id = row.id;
                this.editForm.classLevel = row.classLevel
                console.log(this.editForm);
            },
            //打开编辑弹框
            editThirdOpen(row) {
                this.editThirdVisible = true
                this.editThirdForm.classSequence = row.classSequence
                this.editThirdForm.className = row.className
                this.editThirdForm.iconAccUrl = row.iconAccUrl
                this.editThirdForm.advPosEnc = row.advPosEnc
                this.editThirdForm.id = row.id;
                this.editThirdForm.classLevel = row.classLevel
                console.log(this.editThirdForm);
            },
            editFourOpen(row) {
                detail({id:row.id}).then(res=>{
                    if(res.data.code==200) {
                        this.editFourForm = res.data.data
                    }else {
                        this.$message.error(res.data.message);
                    }
                    this.editFourVisible = true
                })
            },
            //查看
            showOpenFour(row) {
                detail({id:row.id}).then(res=>{
                    if(res.data.code==200) {
                        this.showForm = res.data.data
                    }else {
                        this.$message.error(res.data.message);
                    }
                    this.showVisibleFour = true
                })
            },
            //查看
            showOpen(row) {
                this.showVisible = true
                this.showForm.classSequence = row.classSequence
                this.showForm.className = row.className
                this.showForm.iconAccUrl = row.iconAccUrl
                this.showForm.advPosEnc = row.advPosEnc
                this.showForm.id = row.id;
                this.showForm.classLevel = row.classLevel
                console.log(this.showForm);
            },
            submitAdd(addForm) {
                if(!this.addForm.iconAccUrl){
                    this.$message.error('品类图片不能为空');
                    return false
                }

                setTimeout(() => {
                    this.addLoad = false;
                }, 1000);

                this.$refs[addForm].validate((valid) => {
                    if (valid) {
                        this.addLoad=true
                        add(this.addForm).then(res => {
                                console.log(res);
                                if (res.data.code == 200) {
                                    this.$message.success('成功');
                                    this.onLoad(this.page);
                                    this.addVisible = false;
                                    this.addLoad=false
                                }
                                this.clearAddfrom();
                            })
                        // .catch(err => {
                        //     this.$message.error(err);
                        // })
                    }
                    else {
                        return false
                    }
                })
            },
            submitAddChild(addChildForm) {
                console.log(this.addChildForm)

                if(!this.addChildForm.iconAccUrl){
                    this.$message.error('品类图片不能为空');
                    return false
                }

                setTimeout(() => {
                    this.loadChild = false;
                }, 1000);

                this.$refs[addChildForm].validate((valid) => {
                    if (valid) {
                        this.loadChild=true
                        add(this.addChildForm)
                            .then(res => {
                                console.log(res);
                                if (res.data.code == 200) {
                                    this.loadChild=false
                                    this.$message.success('成功');
                                    this.onLoad(this.page);
                                    this.addChildVisible = false;
                                }
                                this.clearAddChildfrom();
                            })
                        // .catch(err => {
                        //     this.$message.error(err);
                        // })
                    }
                    else {
                        return false
                    }
                })
            },

            submitAddThirdChild(addThirdChildForm) {
                console.log(this.addThirdChildForm)
                // if(!this.addThirdChildForm.iconAccUrl){
                //     this.$message.error('品类图片不能为空');
                //     return false
                // }
                setTimeout(() => {
                    this.loadThirdChild = false;
                }, 1000);

                this.$refs[addThirdChildForm].validate((valid) => {
                    if (valid) {
                        this.loadThirdChild=true
                        add(this.addThirdChildForm)
                            .then(res => {
                                console.log(res);
                                if (res.data.code == 200) {
                                    this.loadThirdChild=false
                                    this.$message.success('成功');
                                    this.onLoad(this.page);
                                    this.addThirdChildVisible = false;
                                }
                                this.clearAddThirdChildfrom();
                            })
                        // .catch(err => {
                        //     this.$message.error(err);
                        // })
                    }
                    else {
                        return false
                    }
                })
            },
            submitAddFourChild(addFourChildForm) {

                // if(!this.addThirdChildForm.iconAccUrl){
                //     this.$message.error('品类图片不能为空');
                //     return false
                // }
                setTimeout(() => {
                    this.loadFourChild = false;
                }, 1000);
                this.$refs[addFourChildForm].validate((valid) => {
                    if (valid) {
                        this.loadFourChild=true
                        add(this.addFourChildForm)
                            .then(res => {
                                console.log(res);
                                if (res.data.code == 200) {
                                    this.loadFourChild=false
                                    this.$message.success('成功');
                                    this.onLoad(this.page);
                                    this.addFourChildVisible = false;
                                }
                                this.clearAddFourChildfrom();
                            })
                        // .catch(err => {
                        //     this.$message.error(err);
                        // })
                    }
                    else {
                        return false
                    }
                })
            },
			closeEdit(){
				this.editVisible=false
			},
			closeShow(){
				this.showVisible=false
				this.showVisibleFour=false
			},
            submitEdit(editForm) {
				this.editDisabled=true
                this.$refs[editForm].validate((valid) => {
                    if (valid) {
                        update(this.editForm)
                            .then(res => {
                                if (res.data.code == 200) {
                                    this.$message.success('修改成功');
                                    this.onLoad(this.page);
                                    this.editVisible = false;
                                }
								this.editDisabled=false
                                this.clearAddfrom();
                            })
                            .catch(err => {
								this.editDisabled=false
                                this.$message.error(err);
                            })
                    }
                    else {
                        this.editDisabled=false
                        return false
                    }
                })
            },

            submitEditThird(editThirdForm) {
				this.isDisabled=true
                this.$refs[editThirdForm].validate((valid) => {
                    if (valid) {
                        update(this.editThirdForm)
                            .then(res => {
                                if (res.data.code == 200) {
                                    this.$message.success('修改成功');
                                    this.onLoad(this.page);
                                    this.editThirdVisible = false;
                                }
								this.isDisabled=false
                                this.clearAddfrom();
                            })
                            .catch(err => {
								this.isDisabled=false
                                this.$message.error(err);
                            })
                    }
                    else {
                        this.isDisabled=false
                        return false
                    }
                })
            },
            submitEditFour(editFourForm) {
                this.isDisabled=true
                this.$refs[editFourForm].validate((valid) => {
                    if (valid) {
                        update(this.editFourForm)
                            .then(res => {
                                if (res.data.code == 200) {
                                    this.$message.success('修改成功');
                                    this.onLoad(this.page);
                                    this.editFourVisible = false;
                                }
                                this.isDisabled=false
                                this.clearAddfrom();
                            })
                            .catch(err => {
                                this.isDisabled=false
                                this.$message.error(err);
                            })
                    }
                    else {
                        this.isDisabled=false
                        return false
                    }
                })
            },

            clearAddfrom() {
                this.addForm = {
                    classSequence: '', //排序
                    className: '', //规格名称
                    iconAccUrl: '', //图片
                    advPosEnc: '', //广告位编码
                };
                this.addVisible=false;
                console.log("新增弹框关闭:"+this.addForm);
            },

            clearAddChildfrom() {
                this.addChildForm = {
                    className: "",
                    classSequence: "",
                    advPosEnc: "",
                    iconAccUrl: "",
                    parentId: "",
                    classLevel: this.addChildForm.classLevel
                };
                console.log("新增二级弹框关闭:"+this.addChildForm);
               this.addChildVisible=false
            },

            clearAddThirdChildfrom() {
                this.addThirdChildForm = {
                    className: "",
                    classSequence: "",
                    advPosEnc: "",
                    iconAccUrl: "",
                    parentId: "",
                    classLevel: this.addThirdChildForm.classLevel
                };
                console.log("新增三级弹框关闭:"+this.addChildForm);
                this.addThirdChildVisible=false
            },
            clearAddFourChildfrom() {
                this.addFourChildForm = {
                    className: "",
                    classSequence: "",
                    advPosEnc: "",
                    iconAccUrl: "",
                    parentId: "",
                    // nameOfService:"",
                    // taxClassificationCode:"",
                    classLevel: this.addFourChildForm.classLevel
                };
                console.log("新增三级弹框关闭:"+this.addChildForm);
                this.addFourChildVisible=false
            },
			cellStyle({row,columnIndex}){
				if(columnIndex==0){
					if(row.classLevel==0){
						return {
							// color:'red',
							fontWeight:'bold',
						}
					}
				}
			},
            searchReset() {
                this.query = {};
                this.onLoad(this.page);
            },
            searchResetList() {
                this.saleQuery = {};
                this.addPropList(this.allSalePropPage);
            },
            searchChange(params,done) {
                this.page.currentPage=1
                this.query = params;
                this.onLoad(this.page, params,done);
            },
            searchChangeList(params,done) {
				this.allSalePropPage.currentPage=1
                this.saleQuery = params;
                this.addPropList(this.allSalePropPage, params,done);
            },
            currentChange(currentPage) {
                this.page.currentPage = currentPage;
            },
            sizeChange(pageSize) {
                this.page.pageSize = pageSize;
            },
            refreshChange() {
                this.onLoad(this.page);
            },
            onLoad(page, params = {},done) {
                this.loading = true;
                params.required=0;      //不为null 查询四级 只有在商品分类处使用
                getList(
                    // page.currentPage,
                    // page.pageSize,
                    0,
                    0,
                    Object.assign(params, this.query)
                ).then(res => {
                    if(done){
                        done();
                    }
                    this.loading = false;
                    // this.page.total = res.data.count;
                    // console.log(res.data)
                    this.data = res.data.data;
                    console.log(this.data);
                });
            },
            showClassBrand(classId) {
                this.box = true;
                this.classId = classId;
            },
            addSpecChangeCurrent(val){
              this.allSalePropPage.currentPage = val;
              this.addPropList(this.allSalePropPage)
            }, 
			addSpecSizeChange(val){
              this.allSalePropPage.pageSize = val;
                this.addPropList(this.allSalePropPage, );
            },
            addPropList(page, params = {},done) {
                params.specType = this.specType;
                this.loading = true;
                getAllSalesProp(
					page.currentPage,
                    page.pageSize,
                    Object.assign(params, this.saleQuery)
                ).then(res => {
                    if(done){
                        done();
                    }
                    this.loading = false;
					if(res.data.code==200){
						this.allSalePropPage.total = res.data.count;
						this.changeProData = this.handleData(res.data.data);
					}else{
                        this.$message.error(res.data.message);
					}
                });
            },
        }
    };
</script>

<style scoped>
    .el-card {
        max-height: 560px;
        height: 560px;
        min-height: 560px;
    }
</style>
